<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>留言互动 - 社交圈</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #3b82f6;
            --primary-light: #60a5fa;
            --primary-dark: #2563eb;
            --secondary: #8b5cf6;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --bg-secondary: #f1f5f9;
            --border-light: #e2e8f0;
            --border-medium: #cbd5e1;
            --radius: 12px;
            --radius-sm: 8px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 80px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        .nav-action.primary {
            color: var(--primary);
        }
        
        /* 帖子内容 */
        .post-container {
            background-color: var(--bg-white);
            padding: 16px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .post-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }
        
        .post-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .post-author {
            flex: 1;
        }
        
        .author-name {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 2px;
        }
        
        .post-time {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }
        
        .post-content {
            margin-bottom: 12px;
            line-height: 1.5;
        }
        
        .post-media {
            margin-bottom: 12px;
            border-radius: var(--radius-sm);
            overflow: hidden;
        }
        
        .post-media.single {
            width: 100%;
            height: 220px;
        }
        
        .post-media.single img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .post-media.multi {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
        }
        
        .post-media.multi img {
            width: 100%;
            height: 100%;
            aspect-ratio: 1/1;
            object-fit: cover;
        }
        
        .post-actions {
            display: flex;
            justify-content: space-around;
            padding-top: 8px;
        }
        
        .post-action {
            display: flex;
            align-items: center;
            gap: 6px;
            color: var(--text-secondary);
            font-size: 0.85rem;
            padding: 6px 12px;
            border-radius: 20px;
        }
        
        .post-action:hover {
            background-color: var(--bg-light);
        }
        
        .post-action.active {
            color: var(--primary);
        }
        
        /* 留言列表容器 */
        .comments-container {
            padding: 12px 16px;
        }
        
        .comments-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .comments-title {
            font-weight: 600;
            font-size: 0.95rem;
        }
        
        .sort-comments {
            color: var(--text-secondary);
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 留言输入框 */
        .comment-input-container {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            padding: 8px 0;
        }
        
        .comment-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
        }
        
        .comment-input-wrapper {
            flex: 1;
            position: relative;
        }
        
        .comment-input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-light);
            border-radius: 20px;
            background-color: var(--bg-light);
            font-size: 0.9rem;
            resize: none;
            height: 40px;
        }
        
        .comment-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-comment {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
        }
        
        /* 留言列表 */
        .comments-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        /* 基础留言样式 */
        .comment-item {
            display: flex;
            gap: 10px;
        }
        
        .comment-content {
            flex: 1;
        }
        
        .comment-main {
            background-color: var(--bg-secondary);
            padding: 10px 12px;
            border-radius: var(--radius-sm);
            margin-bottom: 6px;
        }
        
        .comment-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4px;
        }
        
        .comment-author {
            font-weight: 600;
            font-size: 0.85rem;
        }
        
        .comment-time {
            font-size: 0.7rem;
            color: var(--text-secondary);
        }
        
        .comment-text {
            font-size: 0.9rem;
            line-height: 1.4;
        }
        
        .comment-text .mention {
            color: var(--primary);
            font-weight: 500;
        }
        
        .comment-actions {
            display: flex;
            gap: 16px;
            font-size: 0.75rem;
        }
        
        .comment-action {
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .comment-action:hover {
            color: var(--primary);
        }
        
        .comment-action.liked {
            color: var(--danger);
        }
        
        /* 带图片的留言 */
        .comment-with-media .comment-main {
            padding-bottom: 8px;
        }
        
        .comment-media {
            margin-top: 8px;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .comment-media img {
            width: 100%;
            max-height: 180px;
            object-fit: cover;
        }
        
        /* 回复样式 */
        .comment-replies {
            margin-top: 10px;
            margin-left: 46px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .reply-item {
            display: flex;
            gap: 8px;
        }
        
        .reply-content {
            flex: 1;
        }
        
        .reply-main {
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            padding: 8px 10px;
            border-radius: var(--radius-sm);
            margin-bottom: 4px;
        }
        
        /* 回复输入框 */
        .reply-input-container {
            display: flex;
            gap: 8px;
            margin-top: 8px;
        }
        
        .reply-input {
            flex: 1;
            padding: 6px 10px;
            border: 1px solid var(--border-light);
            border-radius: 16px;
            font-size: 0.85rem;
        }
        
        .reply-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .send-reply {
            width: 26px;
            height: 26px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            flex-shrink: 0;
        }
        
        /* 加载更多 */
        .load-more {
            padding: 12px 0;
            text-align: center;
            font-size: 0.85rem;
            color: var(--primary);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            gap: 4px;
            flex: 1;
            height: 100%;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 1.2rem;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.85rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">留言互动</div>
        <button class="nav-action primary" id="moreBtn">
            <i class="fas fa-ellipsis-h"></i>
        </button>
    </div>
    
    <!-- 帖子内容 -->
    <div class="post-container">
        <div class="post-header">
            <img src="https://picsum.photos/id/64/100/100" alt="发布者头像" class="post-avatar">
            <div class="post-author">
                <div class="author-name">林小艺</div>
                <div class="post-time">今天 14:32</div>
            </div>
            <button class="nav-action">
                <i class="fas fa-ellipsis-h"></i>
            </button>
        </div>
        
        <div class="post-content">
            分享一组周末拍摄的照片，天气真的太好了！大家觉得哪张最好看？😉
        </div>
        
        <div class="post-media multi">
            <img src="https://picsum.photos/id/10/500/500" alt="帖子图片1">
            <img src="https://picsum.photos/id/11/500/500" alt="帖子图片2">
            <img src="https://picsum.photos/id/12/500/500" alt="帖子图片3">
        </div>
        
        <div class="post-actions">
            <div class="post-action">
                <i class="far fa-thumbs-up"></i>
                <span>点赞 (42)</span>
            </div>
            <div class="post-action active">
                <i class="far fa-comment"></i>
                <span>留言 (18)</span>
            </div>
            <div class="post-action">
                <i class="far fa-share-square"></i>
                <span>分享</span>
            </div>
        </div>
    </div>
    
    <!-- 留言列表容器 -->
    <div class="comments-container">
        <div class="comments-header">
            <div class="comments-title">全部留言 (18)</div>
            <div class="sort-comments">
                <span>最新</span>
                <i class="fas fa-chevron-down"></i>
            </div>
        </div>
        
        <!-- 留言输入框 -->
        <div class="comment-input-container">
            <img src="https://picsum.photos/id/237/100/100" alt="我的头像" class="comment-avatar">
            <div class="comment-input-wrapper">
                <textarea class="comment-input" placeholder="写下你的留言..."></textarea>
                <button class="send-comment" id="sendComment">
                    <i class="fas fa-paper-plane"></i>
                </button>
            </div>
        </div>
        
        <!-- 留言列表 -->
        <div class="comments-list">
            <!-- 1. 带图片的留言 -->
            <div class="comment-item comment-with-media">
                <img src="https://picsum.photos/id/91/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-main">
                        <div class="comment-header">
                            <div class="comment-author">王建国</div>
                            <div class="comment-time">刚刚</div>
                        </div>
                        <div class="comment-text">
                            第二张照片的光影处理得太棒了！构图也很专业，求教程！
                        </div>
                        <div class="comment-media">
                            <img src="https://picsum.photos/id/20/500/300" alt="留言附图">
                        </div>
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action like-action">
                            <i class="far fa-thumbs-up"></i>
                            <span>12</span>
                        </div>
                        <div class="comment-action reply-action">
                            <i class="far fa-reply"></i>
                            <span>回复</span>
                        </div>
                    </div>
                    
                    <!-- 回复列表 -->
                    <div class="comment-replies">
                        <div class="reply-item">
                            <img src="https://picsum.photos/id/64/100/100" alt="回复者头像" class="comment-avatar">
                            <div class="reply-content">
                                <div class="reply-main">
                                    <div class="comment-header">
                                        <div class="comment-author">林小艺</div>
                                        <div class="comment-time">5分钟前</div>
                                    </div>
                                    <div class="comment-text">
                                        <span class="mention">@王建国</span> 谢谢喜欢！其实主要是用了黄金时刻拍摄，后期稍微调了下对比度~
                                    </div>
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action like-action">
                                        <i class="far fa-thumbs-up"></i>
                                        <span>5</span>
                                    </div>
                                    <div class="comment-action reply-action">
                                        <i class="far fa-reply"></i>
                                        <span>回复</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 回复输入框 -->
                        <div class="reply-input-container">
                            <img src="https://picsum.photos/id/237/100/100" alt="我的头像" class="comment-avatar" style="width:30px;height:30px;">
                            <input type="text" class="reply-input" placeholder="回复 @王建国...">
                            <button class="send-reply" id="sendReply1">
                                <i class="fas fa-paper-plane"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 2. 普通文字留言 -->
            <div class="comment-item">
                <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-main">
                        <div class="comment-header">
                            <div class="comment-author">赵敏</div>
                            <div class="comment-time">30分钟前</div>
                        </div>
                        <div class="comment-text">
                            第三张照片的角度选得真好，能感受到那种宁静的氛围，请问是在哪里拍的呀？
                        </div>
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action like-action">
                            <i class="far fa-thumbs-up"></i>
                            <span>8</span>
                        </div>
                        <div class="comment-action reply-action">
                            <i class="far fa-reply"></i>
                            <span>回复</span>
                        </div>
                    </div>
                    
                    <!-- 回复列表 -->
                    <div class="comment-replies">
                        <div class="reply-item">
                            <img src="https://picsum.photos/id/64/100/100" alt="回复者头像" class="comment-avatar">
                            <div class="reply-content">
                                <div class="reply-main">
                                    <div class="comment-header">
                                        <div class="comment-author">林小艺</div>
                                        <div class="comment-time">25分钟前</div>
                                    </div>
                                    <div class="comment-text">
                                        <span class="mention">@赵敏</span> 是在城郊的湿地公园拍的，周末人不多，很适合散心~
                                    </div>
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action like-action">
                                        <i class="far fa-thumbs-up"></i>
                                        <span>3</span>
                                    </div>
                                    <div class="comment-action reply-action">
                                        <i class="far fa-reply"></i>
                                        <span>回复</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="reply-item">
                            <img src="https://picsum.photos/id/22/100/100" alt="回复者头像" class="comment-avatar">
                            <div class="reply-content">
                                <div class="reply-main">
                                    <div class="comment-header">
                                        <div class="comment-author">李强</div>
                                        <div class="comment-time">15分钟前</div>
                                    </div>
                                    <div class="comment-text">
                                        <span class="mention">@赵敏</span> 那个地方我也去过，确实很出片！特别是日落时分
                                    </div>
                                </div>
                                <div class="comment-actions">
                                    <div class="comment-action like-action liked">
                                        <i class="fas fa-thumbs-up"></i>
                                        <span>2</span>
                                    </div>
                                    <div class="comment-action reply-action">
                                        <i class="far fa-reply"></i>
                                        <span>回复</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 3. 带引用的留言 -->
            <div class="comment-item">
                <img src="https://picsum.photos/id/22/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-main">
                        <div class="comment-header">
                            <div class="comment-author">李强</div>
                            <div class="comment-time">1小时前</div>
                        </div>
                        <div class="comment-text">
                            我觉得第一张最好看，色彩特别舒服！
                        </div>
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action like-action liked">
                            <i class="fas fa-thumbs-up"></i>
                            <span>15</span>
                        </div>
                        <div class="comment-action reply-action">
                            <i class="far fa-reply"></i>
                            <span>回复</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 4. 简单留言 -->
            <div class="comment-item">
                <img src="https://picsum.photos/id/177/100/100" alt="用户头像" class="comment-avatar">
                <div class="comment-content">
                    <div class="comment-main">
                        <div class="comment-header">
                            <div class="comment-author">张婷</div>
                            <div class="comment-time">2小时前</div>
                        </div>
                        <div class="comment-text">
                            拍得真好看！求相机型号和镜头~
                        </div>
                    </div>
                    <div class="comment-actions">
                        <div class="comment-action like-action">
                            <i class="far fa-thumbs-up"></i>
                            <span>6</span>
                        </div>
                        <div class="comment-action reply-action">
                            <i class="far fa-reply"></i>
                            <span>回复</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <div class="load-more" id="loadMore">
            <span>查看更多留言</span>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <div class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-plus-circle nav-icon"></i>
            <span>发布</span>
        </div>
        <div class="nav-item active">
            <i class="fas fa-bell nav-icon"></i>
            <span>通知</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </div>
    </div>
    
    <!-- 提示消息元素 -->
    <div class="toast" id="toast"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 发送留言
        document.getElementById('sendComment').addEventListener('click', function() {
            const commentInput = document.querySelector('.comment-input');
            const commentText = commentInput.value.trim();
            
            if (commentText) {
                showToast('留言发布成功');
                commentInput.value = '';
                // 这里可以添加实际发布留言的逻辑
            } else {
                showToast('请输入留言内容');
            }
        });
        
        // 发送回复
        document.getElementById('sendReply1').addEventListener('click', function() {
            const replyInput = this.parentElement.querySelector('.reply-input');
            const replyText = replyInput.value.trim();
            
            if (replyText) {
                showToast('回复成功');
                replyInput.value = '';
                // 这里可以添加实际发布回复的逻辑
            } else {
                showToast('请输入回复内容');
            }
        });
        
        // 点赞功能
        document.querySelectorAll('.like-action').forEach(btn => {
            btn.addEventListener('click', function() {
                const isLiked = this.classList.contains('liked');
                const likeCount = this.querySelector('span');
                let count = parseInt(likeCount.textContent);
                
                if (isLiked) {
                    this.classList.remove('liked');
                    this.innerHTML = '<i class="far fa-thumbs-up"></i><span>' + (count - 1) + '</span>';
                    showToast('已取消点赞');
                } else {
                    this.classList.add('liked');
                    this.innerHTML = '<i class="fas fa-thumbs-up"></i><span>' + (count + 1) + '</span>';
                    showToast('点赞成功');
                }
            });
        });
        
        // 回复功能 - 点击回复显示输入框
        document.querySelectorAll('.reply-action').forEach(btn => {
            btn.addEventListener('click', function() {
                const commentContent = this.closest('.comment-content, .reply-content');
                const repliesContainer = commentContent.nextElementSibling?.classList.contains('comment-replies') 
                    ? commentContent.nextElementSibling 
                    : null;
                
                // 如果已经有回复输入框则聚焦，否则创建
                if (repliesContainer) {
                    let replyInput = repliesContainer.querySelector('.reply-input-container');
                    if (replyInput) {
                        replyInput.querySelector('.reply-input').focus();
                    } else {
                        // 创建新的回复输入框
                        const authorName = commentContent.querySelector('.comment-author').textContent;
                        const newReplyInput = `
                            <div class="reply-input-container">
                                <img src="https://picsum.photos/id/237/100/100" alt="我的头像" class="comment-avatar" style="width:30px;height:30px;">
                                <input type="text" class="reply-input" placeholder="回复 @${authorName}...">
                                <button class="send-reply">
                                    <i class="fas fa-paper-plane"></i>
                                </button>
                            </div>
                        `;
                        repliesContainer.insertAdjacentHTML('beforeend', newReplyInput);
                        
                        // 为新创建的回复按钮添加事件
                        const newSendBtn = repliesContainer.querySelector('.send-reply:last-of-type');
                        newSendBtn.addEventListener('click', function() {
                            const input = this.parentElement.querySelector('.reply-input');
                            if (input.value.trim()) {
                                showToast('回复成功');
                                input.value = '';
                            } else {
                                showToast('请输入回复内容');
                            }
                        });
                        
                        // 聚焦到输入框
                        repliesContainer.querySelector('.reply-input').focus();
                    }
                }
            });
        });
        
        // 加载更多留言
        document.getElementById('loadMore').addEventListener('click', function() {
            this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
            
            // 模拟加载延迟
            setTimeout(() => {
                this.innerHTML = '<span>查看更多留言</span>';
                showToast('已加载更多留言');
            }, 1500);
        });
        
        // 排序切换
        document.querySelector('.sort-comments').addEventListener('click', function() {
            showToast('已切换排序方式');
            // 这里可以添加实际排序切换的逻辑
        });
        
        // 返回按钮
        document.getElementById('backBtn').addEventListener('click', function() {
            history.back();
        });
        
        // 更多按钮
        document.getElementById('moreBtn').addEventListener('click', function() {
            showToast('更多选项已打开');
        });
        
        // 提示消息功能
        function showToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.classList.add('show');
            
            setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
    </script>
</body>
</html>

